﻿using ET.Monitor.DAL;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ET.Monitor.Model
{
    public class DeviceModel
    {
        string id = "";
        int type = 0;
        DateTime st = new DateTime();
        DateTime et = new DateTime();

        public DeviceModel() { }
        public DeviceModel(string dId) { id = dId; }
        public DeviceModel(string dId, int type) { id = dId; this.type = type; }
        public DeviceModel(string id, DateTime st, DateTime et)
        {
            this.id = id;
            this.st = st;
            this.et = et;
        }

        string resion = "", plant = "";
        public DeviceModel(string id, string resion, string plant)
        {
            this.id = id;
            this.resion = resion;
            this.plant = plant;
        }





        DeviceDAL dal = new DeviceDAL();

        #region 大类故障
        DataTable dtFault;

        public DataTable DtFault
        {
            get { return dal.GetFaultRecordCount(id, st, et); }
            set { dtFault = value; }
        }
        #endregion

        #region 设备树
        DataTable dtDevice;

        public DataTable DtDevice
        {
            get { return dal.GetDevice(); }
            set { dtDevice = value; }
        }

        #endregion

        #region 故障原因
        object objFaultReason;
        public object ObjFaultReason
        {
            get
            {
                return dal.GetFaultReason(id); ;
            }

            set
            {
                objFaultReason = value;
            }
        }
        #endregion

        #region 故障建议
        object objFaultProposal;

        public object ObjFaultProposal
        {
            get
            {
                return dal.GetFaultProposal(id);
            }

            set
            {
                objFaultProposal = value;
            }
        }
        #endregion

        #region 设备故障类型
        IList<Hashtable> list;

        public IList<Hashtable> List
        {
            get
            {
                return dal.GetFaultName();
            }

            set
            {
                list = value;
            }
        }
        #endregion

        #region 编辑故障
        bool blFault;

        public bool BlFault
        {
            get
            {
                return dal.EditFault(id, resion, plant);
            }

            set
            {
                blFault = value;
            }
        }
        #endregion


        #region 电站下其他设备
        IList<Hashtable> dtBox;

        public IList<Hashtable> DtBox
        {
            get
            {
                return dal.GetDevice(id);
            }

            set
            {
                dtBox = value;
            }
        }
        #endregion

        #region 其他设备详细信息
        ArrayList listBox;

        public ArrayList ListBox
        {
            get
            {
                return dal.GetDevicePointInfo(id);
            }

            set
            {
                listBox = value;
            }
        }
        #endregion
    }
}
